/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.entites;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.NamedStoredProcedureQueries;
import javax.persistence.NamedStoredProcedureQuery;
import javax.persistence.ParameterMode;
import javax.persistence.StoredProcedureParameter;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Chung
 */
@Entity
@Table(name = "Notifications")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Notifications.findAll", query = "SELECT n FROM Notifications n"),
    @NamedQuery(name = "Notifications.findById", query = "SELECT n FROM Notifications n WHERE n.id = :id"),
    @NamedQuery(name = "Notifications.findByStatus", query = "SELECT n FROM Notifications n WHERE n.status = :status"),
    @NamedQuery(name = "Notifications.findByAvatarImg", query = "SELECT n FROM Notifications n WHERE n.avatarImg = :avatarImg"),
    @NamedQuery(name = "Notifications.findByFullname", query = "SELECT n FROM Notifications n WHERE n.fullname = :fullname"),
    @NamedQuery(name = "Notifications.findByMessage", query = "SELECT n FROM Notifications n WHERE n.message = :message"),
    @NamedQuery(name = "Notifications.findByNameEvent", query = "SELECT n FROM Notifications n WHERE n.nameEvent = :nameEvent"),
    @NamedQuery(name = "Notifications.findByBirthdate", query = "SELECT n FROM Notifications n WHERE n.birthdate = :birthdate")})

@NamedStoredProcedureQuery(name = "Notifications.SendInvitedAttendEvent", procedureName = "sp_SendInvitedAttendEvent", parameters = {
        @StoredProcedureParameter(name = "usernameME", mode = ParameterMode.IN, type = String.class),
        @StoredProcedureParameter(name = "usernameFE", mode = ParameterMode.IN, type = String.class),
        @StoredProcedureParameter(name = "messages", mode = ParameterMode.IN, type = String.class),
        @StoredProcedureParameter(name = "eventId", mode = ParameterMode.IN, type = Integer.class)

    })
public class Notifications implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "Id")
    private Integer id;
    @Size(max = 1)
    @Column(name = "Status")
    private String status;
    @Size(max = 200)
    @Column(name = "AvatarImg")
    private String avatarImg;
    @Size(max = 50)
    @Column(name = "Fullname")
    private String fullname;
    @Size(max = 600)
    @Column(name = "Message")
    private String message;
    @Size(max = 200)
    @Column(name = "NameEvent")
    private String nameEvent;
    @Column(name = "Birthdate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date birthdate;
    @JoinColumn(name = "UsernameME", referencedColumnName = "Username")
    @ManyToOne
    private Employee usernameME;
    @JoinColumn(name = "UsernameFE", referencedColumnName = "Username")
    @ManyToOne
    private Employee usernameFE;
    @JoinColumn(name = "EventId", referencedColumnName = "EventId")
    @ManyToOne
    private EventLibrary eventId;
    @JoinColumn(name = "NotificationTypeID", referencedColumnName = "Id")
    @ManyToOne
    private NotificationType notificationTypeID;

    private String usnMe;
    private String usnFe;
    private int evId;
    public Notifications() {
    }
    
    public Notifications(String usnMe,String usnFe,String message,int evId) {
        this.usnMe=usnMe;
        this.usnFe=usnFe;
        this.message=message;
        this.evId=evId;
    }

    public String getUsnMe() {
        return usnMe;
    }

    public void setUsnMe(String usnMe) {
        this.usnMe = usnMe;
    }

    public String getUsnFe() {
        return usnFe;
    }

    public void setUsnFe(String usnFe) {
        this.usnFe = usnFe;
    }

    public int getEvId() {
        return evId;
    }

    public void setEvId(int evId) {
        this.evId = evId;
    }

    
    public Notifications(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getAvatarImg() {
        return avatarImg;
    }

    public void setAvatarImg(String avatarImg) {
        this.avatarImg = avatarImg;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getNameEvent() {
        return nameEvent;
    }

    public void setNameEvent(String nameEvent) {
        this.nameEvent = nameEvent;
    }

    public Date getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    public Employee getUsernameME() {
        return usernameME;
    }

    public void setUsernameME(Employee usernameME) {
        this.usernameME = usernameME;
    }

    public Employee getUsernameFE() {
        return usernameFE;
    }

    public void setUsernameFE(Employee usernameFE) {
        this.usernameFE = usernameFE;
    }

    public EventLibrary getEventId() {
        return eventId;
    }

    public void setEventId(EventLibrary eventId) {
        this.eventId = eventId;
    }

    public NotificationType getNotificationTypeID() {
        return notificationTypeID;
    }

    public void setNotificationTypeID(NotificationType notificationTypeID) {
        this.notificationTypeID = notificationTypeID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Notifications)) {
            return false;
        }
        Notifications other = (Notifications) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entites.Notifications[ id=" + id + " ]";
    }
    
}
